package com.example.lotterysystem.common.exception;

import com.example.lotterysystem.common.errorcode.ControllerErrorCodeConstants;
import com.example.lotterysystem.common.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 25228
 * Date: 2025-06-17
 * Time: 22:06
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class ServiceException extends RuntimeException{
    /**
     * 异常代码
     * @see com.example.lotterysystem.common.errorcode.ServiceErrorCodeConstants
     */
    private Integer code;
    /**
     * 异常消息
     */
    private String msg;

    public ServiceException(){

    }

    public ServiceException(int code,String msg){
        this.code=code;
        this.msg=msg;
    }

    public ServiceException(ErrorCode error){
        this.code=error.getCode();
        this.msg=error.getMsg();
    }
}
